The utility functions described in this section map between data formats used by Windows and those used by QuickTime.
NativeEventToMacEvent converts Win32 messages to Macintosh events.
long NativeEventToMacEvent(void *nativeEvent, EventRecord *macEvent);
Use this function from a WndProc to convert a message structure to an equivalent Macintosh event record. NativeEventToMacEvent translates Win32 message types into Macintosh event types and fills in the various other EventRecord fields based on the source Win32 MSG . Typically, when your application hosts a movie controller, it should call NativeEventToMacEvent to translate a Win32 MSG to an EventRecord , and then pass the resulting EventRecord to MCIsPlayerEvent for processing. This function returns noErr if the translation succeeded. You should never call this function and then exit early from your WndProc without calling DefWindowProc or returning an appropriate result code from your WndProc .
You use the GetPictFromDIB function to create a QuickDraw PicHandle from a handle to a DIB .
PicHandle GetPictFromDIB (void *h);
The GetPictFromDIB function returns a PicHandle when passed a handle to a DIB . The caller is responsible for releasing the memory of the PicHandle . You call the function KillPicture to release the memory of PicHandle .
Note that this function does not work for HBITMAP .
The format of the DIB handle is the same as returned by GetClipboardData with CF_DIB .
You use the GetDIBFromPict function to create a handle to a DIB from a QuickDraw PicHandle .
void *GetDIBFromPict (PicHandle hPict);
The NativeRegionToMacRegion function converts a Windows HRGN to a Macintosh region handle.
RgnHandle NativeRegionToMacRegion(void *nativeRegion)
The MacRegionToNativeRegion function converts a Macintosh region handle to a Windows HRGN .
void *MacRegionToNativeRegion(RgnHandle macRegion);
The FSSpecToNativePathName function extracts the native pathname from an FSSpec .
OSErr FSSpecToNativePathName(FSSpec *inFile, char *outName,
unsigned long outLen, long flags);
As an example, consider the following Windows full path:
D:\Media\My Movies\Really Cool Movies\Tasty Fish.mov
If you have an FSSpec for this path, you can extract either the whole path or portions of the path using one of the above flags. For the above path and each flag, the resulting strings are:
D:\Media\My Movies\Really Cool Movies\Tasty Fish.mov
Tasty Fish.mov
Using kDirectoryPathOnly gives
D:\Media\My Movies\Really Cool Movies
Sometimes, developers may need to convert a FSSpec returned by QuickTime APIs to a native pathname to be passed into the current operating system. The FSSpecToNativePathName function accepts an FSSpec and fills in the buffer pathname whose size is pathnameMaxBufferSize with the equivalent pathname string. This size must also include the size necessary to hold the string terminator.
The NativePathNameToFSSpec function, given a native pathname, returns an FSSpec for that file.
OSErr NativePathNameToFSSpec(char *inName, FSSpec *outFile, long flags);
Given a C string pathname from the operating system, this routine updates the FSSpec of outFile to describe the same file. There are no flags currently defined, so you should pass 0. If the file does not currently exist, the error fnfErr is returned, but the resulting FSSpec is still valid for creating the file.
The QTMLGetCanonicalPathName routine takes a native file path and returns the one canonical path to that file.
OSErr QTMLGetCanonicalPathName(char *inName, char *outName,
unsigned long outLen);
This routine takes a native file path and returns the one canonical path to that file.
Some of the tasks performed by this routine include:
For example, if you have a file with the following path
c:\Program Files\Some Product\test.mov
and the 8.3 path happens to be:
c:\PROGRA~1\SOMEPR~1\test.mov
you can pass any of the following paths to QTMLGetCanonicalPathName
c:\Some other folder\..\program FILES\another program\..\somepr~1\TeSt.MoV
C:\proGra~1\Some product\..\SOMEPR~1\..\..\program files\some product\test.mov
C:\PROGRA~1\SOMEPR~1\TEST.MOV
c:\Program Files\Some Product\test.mov
There is a one-to-one mapping between canonical pathnames and files. In other words, you can determine if two paths point to the same file by canonicalizing both paths, and then doing a string compare.
This routine also works for universal naming convention (UNC) paths. These paths are of the form:
\\my_server\shared_folder\another folder\test.mov
The QTMLGetVolumeRootPath routine takes a Windows path and returns that portion of it which points to the volume root.
OSErr QTMLGetVolumeRootPath(char *fullPath, char * volumeRootPath, unsigned long
volumeRootLen);
| Previous | Chapter Contents | Chapter Top | Roadmap | Next |